package crazy.memory;

public class InitTest
{
	public static void main(String[] args)
	{
		Cat cat = new Cat("Kitty", 2);
		System.out.println(cat);
		
		Cat c = new Cat("Jerfield", 3);
		System.out.println(c);
	}
}

class Cat
{
	String name;
	int age;
	
	public Cat(String name, int age)
	{
		System.out.println("执行构造器");
		this.name = name;
		this.age = age;
	}
	
	{
		System.out.println("执行初始化块");
		weight = 2.0;
	}
	
	double weight = 2.3;
	
	public String toString()
	{
		return "Cat[name="+name+", age="+age+", weight="+weight+"]";
	}
}
